<div class="people view">
<h2><?php  __('Profile');?></h2>
	<dl><?php $i = 0; $class = ' class="altrow"';?>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $person['Person']['id']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Name'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $person['Person']['name']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Gender'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $person['Person']['gender']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Caloric Goal'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $person['Person']['cal_goal']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Height'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $person['Person']['height']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Weight'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php 
				// default sorting by date ASC
				// last item will be most recent weight
				echo $person['Weight'][count($person['Weight']) -1]['value']; 
			?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Updated'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $person['Person']['updated']; ?>
			&nbsp;
		</dd>
	</dl>
</div>
<div class="actions">
	<h3><?php __('Actions'); ?></h3>
	<ul>
		<li><?php echo $this->Html->link(__('Edit Person', true), array('action' => 'edit', $person['Person']['id'])); ?> </li>
		<li><?php echo $this->Html->link(__('Delete Person', true), array('action' => 'delete', $person['Person']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $person['Person']['id'])); ?> </li>
		<li><?php echo $this->Html->link(__('List People', true), array('action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Person', true), array('action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Meals', true), array('controller' => 'meals', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Meal', true), array('controller' => 'meals', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Points', true), array('controller' => 'points', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Point', true), array('controller' => 'points', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Weights', true), array('controller' => 'weights', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Weight', true), array('controller' => 'weights', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Workouts', true), array('controller' => 'workouts', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Workout', true), array('controller' => 'workouts', 'action' => 'add')); ?> </li>
	</ul>
</div>
<div class="related">
	<h3><?php __('Related Meals');?></h3>
	<?php if (!empty($person['Meal'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Id'); ?></th>
		<th><?php __('Person Id'); ?></th>
		<th><?php __('Date'); ?></th>
		<th><?php __('Name'); ?></th>
		<th><?php __('Calories'); ?></th>
		<th><?php __('Grams Carb'); ?></th>
		<th><?php __('Grams Fat'); ?></th>
		<th><?php __('Grams Protein'); ?></th>
		<th><?php __('Notes'); ?></th>
		<th><?php __('Created'); ?></th>
		<th><?php __('Updated'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($person['Meal'] as $meal):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $meal['id'];?></td>
			<td><?php echo $meal['person_id'];?></td>
			<td><?php echo $meal['date'];?></td>
			<td><?php echo $meal['name'];?></td>
			<td><?php echo $meal['calories'];?></td>
			<td><?php echo $meal['grams_carb'];?></td>
			<td><?php echo $meal['grams_fat'];?></td>
			<td><?php echo $meal['grams_protein'];?></td>
			<td><?php echo $meal['notes'];?></td>
			<td><?php echo $meal['created'];?></td>
			<td><?php echo $meal['updated'];?></td>
			<td class="actions">
				<?php echo $this->Html->link(__('View', true), array('controller' => 'meals', 'action' => 'view', $meal['id'])); ?>
				<?php echo $this->Html->link(__('Edit', true), array('controller' => 'meals', 'action' => 'edit', $meal['id'])); ?>
				<?php echo $this->Html->link(__('Delete', true), array('controller' => 'meals', 'action' => 'delete', $meal['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $meal['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $this->Html->link(__('New Meal', true), array('controller' => 'meals', 'action' => 'add'));?> </li>
		</ul>
	</div>
</div>
<div class="related">
	<h3><?php __('Related Points');?></h3>
	<?php if (!empty($person['Point'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Id'); ?></th>
		<th><?php __('Person Id'); ?></th>
		<th><?php __('Points'); ?></th>
		<th><?php __('Created'); ?></th>
		<th><?php __('Updated'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($person['Point'] as $point):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $point['id'];?></td>
			<td><?php echo $point['person_id'];?></td>
			<td><?php echo $point['points'];?></td>
			<td><?php echo $point['created'];?></td>
			<td><?php echo $point['updated'];?></td>
			<td class="actions">
				<?php echo $this->Html->link(__('View', true), array('controller' => 'points', 'action' => 'view', $point['id'])); ?>
				<?php echo $this->Html->link(__('Edit', true), array('controller' => 'points', 'action' => 'edit', $point['id'])); ?>
				<?php echo $this->Html->link(__('Delete', true), array('controller' => 'points', 'action' => 'delete', $point['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $point['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $this->Html->link(__('New Point', true), array('controller' => 'points', 'action' => 'add'));?> </li>
		</ul>
	</div>
</div>
<div class="related">
	<h3><?php __('Related Weights');?></h3>
	<?php if (!empty($person['Weight'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Id'); ?></th>
		<th><?php __('Person Id'); ?></th>
		<th><?php __('Value'); ?></th>
		<th><?php __('Created'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($person['Weight'] as $weight):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $weight['id'];?></td>
			<td><?php echo $weight['person_id'];?></td>
			<td><?php echo $weight['value'];?></td>
			<td><?php echo $weight['created'];?></td>
			<td class="actions">
				<?php echo $this->Html->link(__('View', true), array('controller' => 'weights', 'action' => 'view', $weight['id'])); ?>
				<?php echo $this->Html->link(__('Edit', true), array('controller' => 'weights', 'action' => 'edit', $weight['id'])); ?>
				<?php echo $this->Html->link(__('Delete', true), array('controller' => 'weights', 'action' => 'delete', $weight['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $weight['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $this->Html->link(__('New Weight', true), array('controller' => 'weights', 'action' => 'add'));?> </li>
		</ul>
	</div>
</div>
<div class="related">
	<h3><?php __('Related Workouts');?></h3>
	<?php if (!empty($person['Workout'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Id'); ?></th>
		<th><?php __('Person Id'); ?></th>
		<th><?php __('Name'); ?></th>
		<th><?php __('Date'); ?></th>
		<th><?php __('Duration'); ?></th>
		<th><?php __('Created'); ?></th>
		<th><?php __('Updated'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($person['Workout'] as $workout):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $workout['id'];?></td>
			<td><?php echo $workout['person_id'];?></td>
			<td><?php echo $workout['name'];?></td>
			<td><?php echo $workout['date'];?></td>
			<td><?php echo $workout['duration'];?></td>
			<td><?php echo $workout['created'];?></td>
			<td><?php echo $workout['updated'];?></td>
			<td class="actions">
				<?php echo $this->Html->link(__('View', true), array('controller' => 'workouts', 'action' => 'view', $workout['id'])); ?>
				<?php echo $this->Html->link(__('Edit', true), array('controller' => 'workouts', 'action' => 'edit', $workout['id'])); ?>
				<?php echo $this->Html->link(__('Delete', true), array('controller' => 'workouts', 'action' => 'delete', $workout['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $workout['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $this->Html->link(__('New Workout', true), array('controller' => 'workouts', 'action' => 'add'));?> </li>
		</ul>
	</div>
</div>
